﻿using MaterialSkin;
using MaterialSkin.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TomatoClock.Views
{
    public partial class AddGroupNameForm : MaterialForm
    {
        public string GroupName;
        private readonly MaterialSkinManager materialSkinManager;


        private float x;//定义当前窗体的宽度
        private float y;//定义当前窗体的高度
        public AddGroupNameForm()
        {
            InitializeComponent();
            materialSkinManager = MaterialSkinManager.Instance; // 初始化 MaterialSkinManager 实例
            materialSkinManager.AddFormToManage(this);  // 将要应用 Material Design 的窗体添加到管理列表中
            materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;   // Theme 属性用来设置整体的主题
            materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); // ColorScheme 属性来设置配色方案
            materialTextBox1.Text = "输入新建组名";
            materialTextBox1.ForeColor = Color.Gray;
        }

        private void materialButton1_Click(object sender, EventArgs e)
        {
            GroupName = materialTextBox1.Text.Trim();
            if(!string.IsNullOrEmpty(GroupName)) {
                DialogResult = DialogResult.OK;
            }
            Close();
        }

        private void materialButton2_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            Close();
        }

        private void materialTextBox1_GotFocus(object sender, EventArgs e)
        {
            if (materialTextBox1.Text == "输入新建组名")
            {
                materialTextBox1.Text = ""; // 清空文本框
                materialTextBox1.ForeColor = Color.Black; // 设置文本颜色
            }
        }

        private void materialTextBox1_LostFocus(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(materialTextBox1.Text))
            {
                materialTextBox1.Text = "输入新建组名"; // 恢复水印文字
                materialTextBox1.ForeColor = Color.Gray; // 设置文本颜色
            }
        }
    }
}
